#include "test_usb.h"
#include "cm_uart.h"
#include "cm_demo_uart.h"

extern char *cmmqtt_glob_pubmessage_4k;

static void test_usb_recv_callback(void *data, int32_t len)
{
    cm_demo_printf("data len:%d\ndata:",len);
    for(int i = 0;i<len;i++)
    {
        cm_demo_printf("%c",((char*)data)[i]);
    }
    cm_demo_printf("\n");

}

void cm_test_usb_operation(unsigned char*cmd[],int len)
{
    if(0==strcmp("REG_RECV_CB",cmd[2]))
    {
        // cm_usb2com_recv_cb recv_cb = test_usb_recv_callback;
        // cm_usb2com_register_recv_cb( recv_cb);
        // cm_demo_printf("cm_usb2com_register_recv_cb no ret\n");
    }else if(0==strcmp("SEND",cmd[2]))
    {
        int32_t usb2com_send_data = cm_usb2com_send_data(cmmqtt_glob_pubmessage_4k, 4100);
        cm_demo_printf("cm_usb2com_send_data ret:%d\n",usb2com_send_data);
        OCTEST_FUNC_EXPECT_EQUAL_INT32(0,usb2com_send_data,cm_usb2com_send_data);
    }
    else
    {
        cm_demo_printf("param error!\n");
    }
}